package com.example.fresh_fruit.controller;

import com.example.fresh_fruit.entity.Supplier;
import com.example.fresh_fruit.service.SupplierService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author :飞天の鱼
 * @date : 2022/8/16 16:53
 */
@Slf4j
@RestController
@RequestMapping("/supplier")
public class SupplierController {

    @Autowired
    private SupplierService supplierService;

    @GetMapping("/selectAll")
    public List<Supplier> selectAll() {
        return supplierService.selectAll();
    }

    @PostMapping("/insert")
    public boolean insertSupplier(Supplier supplier) {
        return supplierService.insertSupplier(supplier);
    }

    @PostMapping("/findByName")
    public List<Supplier> findName(@RequestBody String name){
        return supplierService.findName(name);
    }
}
